import 'package:flutter_base/common/fun.dart';
import 'package:flutter_base/model/user_model.dart';
import 'package:flutter_base/net/http.dart';

/// Create： Zhang 3/19/21 9:39 AM
/// 描述：项目接口请求,统一管理

const baseUrl = "https://www.wanandroid.com";
//登录
const loginUrl = "$baseUrl/user/login";

//用户登录
void login(String userName, String password, Callback<UserModel> callback) {
  post(
    loginUrl,
    parameters: {"username": userName, "password": password},
    callBack: (res) {
      var userModel = UserModel.fromJson(res);
      callback(userModel);
    },
  );
}
